alert('ni hao')

window.onload = function () {
  setTimeout(function () {
    ajax()
  }, 5000)
}

function ajax () {
  var xmlhttp
  if (window.XMLHttpRequest) {
    //  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
    xmlhttp = new XMLHttpRequest()
  } else {
    // IE6, IE5 浏览器执行代码
    xmlhttp = new ActiveXObject('Microsoft.XMLHTTP')
  }

  xmlhttp.onreadystatechange = function () {
    console.log('onreadystatechange ...')
    if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
      console.log('ok')
      document.getElementsByTagName('div')[0].innerHTML = '<pre>' + xmlhttp.responseText + '</pre>'
    }
  }

  xmlhttp.open('POST', '/')
  xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
  xmlhttp.send('name=xiaoming&age=20')
}
